package com.shuhe.timer;

import com.shuhe.common.Tools;

import java.util.Calendar;
import java.util.TimerTask;

public class MyTaskDelData extends TimerTask {
    private static boolean isRunning = false;

    public MyTaskDelData() {
    }

    public void run() {
        Calendar cal = Calendar.getInstance();
        if (!isRunning) {
            if (true) {
                isRunning = true;
                System.out.println("开始执行指定任务----------数据删除开始");
                try {

                    Tools.delData(-2, "add", "day");
                    Tools.delData(-31, "add", "month");


                } catch (Exception ex) {
                    ex.printStackTrace();
                }
                isRunning = false;
                System.out.println("开始执行指定任务----------数据删除结束");
            }
        } else {
            System.out.println("上一次任务执行还未结束");
        }
    }


}

